Skip to content

Conversation

Copy link

Copilot AI commented Jan 19, 2026

The pafy library is deprecated and fails to install on modern Python environments, causing ModuleNotFoundError on Windows builds. The project already uses yt-dlp (the modern youtube-dl fork) in node_youtube.py, but was still depending on pafy in one location.

Changes

  • node/InputNode/node_webrtc.py: Replace pafy.new() with yt_dlp.YoutubeDL for video URL extraction
  • node/InputNode/node_youtube.py, node/StatsNode/node_bar.py: Remove unused import pafy statements
  • requirements.txt, CV_Studio.spec, build_exe.py: Remove pafy from dependencies and build configuration

Implementation

Before (node_webrtc.py):

pafy_video = pafy.new(youtube_url)
pafy_best_video = pafy_video.getbest(preftype="mp4")
youtube_capture = YoutubeCapture(pafy_best_video.url)

After (node_webrtc.py):

ydl_opts = {
    'quiet': True,
    'format': 'best[ext=mp4]/best',  # Prefer MP4, fallback to best
}
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
    info = ydl.extract_info(youtube_url, download=False)
    video_url = info.get('url')
    youtube_capture = YoutubeCapture(video_url)

This approach matches the existing pattern in node_youtube.py and provides better error handling with specific exception types.

Original prompt

ModuleNotFoundError: No module named 'pafy' for windows buildin


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 19, 2026 11:44
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ModuleNotFoundError for pafy module Remove deprecated pafy dependency, replace with yt-dlp Jan 19, 2026
Copilot AI requested a review from hackolite January 19, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants